﻿<cfsilent>
	<cfscript>
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		markAdvice = getProperty("serviceFactory").getBean("markAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		
		event.setArg("pageTitle", "教学运行管理 - 考试安排 - 提前考试学生");
		
		taskId = event.getArg("taskId");
		
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		
		sql = "select a.stu_name, a.stu_id,a.stu_name_english, a.stu_idcard ,
					(select 1 from t_new_examAdvice_student b where b.stu_id = a.stu_id and b.task_id = :taskId ) isChecked 
				FROM t_student a 
					INNER JOIN t_student_course b ON b.stu_id = a.stu_id 
				WHERE b.task_id = :taskId 
				ORDER BY isChecked,stu_name ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
		
		rs_student = queryObj.execute( sql=sql ).getResult();
		
		
		sql = "select a.*, c.tch_name, d.course_name,d.course_credit,e.classroom 
				from t_new_examtaskAdvice a 
				INNER JOIN t_task b on b.tsk_id = a.task_id 
				INNER JOIN t_teacher c ON c.tch_id = b.tch_id 
				INNER JOIN t_course d ON d.cid = b.cid 
				INNER JOIN t_classroom e ON e.cr_id = a.cr_id 
				where a.task_id = :taskId 
				order by e.classroom, a.date_exam, a.time_start"; 
		
		queryObj = new query( datasource=application.dnsSlave );
		
		queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
		
		rs_examTaskAdvice = queryObj.execute( sql=sql ).getResult();
		
	
	
		currentTab = 'labStu';
	
		passArgs = structNew();
		structInsert(passArgs, "taskId", taskId, true);
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('examByDepartment&TabID=labAdviceArrange')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">考试安排详情</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput>《<cfoutput>#rs_examTaskAdvice.course_name#</cfoutput>》 - <cfoutput>#rs_examTaskAdvice.tch_name#</cfoutput> 提前考试学生安排
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<div class="UItab">
					<div class="tabLables">
                    	
                        	<span <cfif currentTab eq "labStu">class="active"</cfif> id="labStu" tabTarget="Student">提前考试学生</span>
                       
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
                    
				<div id="Student" class="tabContent">
						
							
									
									
									<cfset row = 0 />
								
									<table class="UIEditable" data-target="">
										<thead>
											<tr>
												<td width="18"></td>
												<td>名字</td>
												<td>英文名</td>
												<td  >护照号</td>
												<td  >学号</td>
											</tr>
										</thead>
										<tbody>
                                          		 <cfloop query="rs_student">
											
													<tr class="editRows ">
                                                                 
														<td><cfif rs_student.isChecked eq '1'><a onclick="javascript:changeState('<cfoutput>#rs_student.stu_id#</cfoutput>')" class="stat yes marktrigger" data-rowid=""></a>
                                                                      	<cfelse>
                                                                           	<a onclick="javascript:changeState('<cfoutput>#rs_student.stu_id#</cfoutput>')" class="stat no marktrigger" data-rowid=""></a>
                                                                           </cfif>
                                                                      </td>
                                                                     
														
														<td><cfoutput>#rs_student.stu_name#</cfoutput> </td>
														<td><cfoutput>#rs_student.stu_name_english#</cfoutput> </td>
														<td align="center"><span class="numeric"><cfoutput>#rs_student.stu_idcard#</cfoutput></span></td>
														<td align="center"><span class="numeric"><cfoutput>#rs_student.stu_id#</cfoutput></span></td>
                                                                    
													</tr>
												
											</cfloop>
									</table>
							
			
					<script language="javascript" type="text/javascript">
						
						
						//<![CDATA[
						<!--
						function changeState(stuId){
							
							/* 显示阻挡信息 */
							$.blockUI({ 
								 message: '正在提交...',
								 css: { 
										 'width': '16%',
										 'left': '42%',
										 'border': 'none', 
										 'padding': '15px 5px', 
										 'backgroundColor': '#090', 
										 'border-radius': '4px', 
										 'opacity': .8, 
										 'color': '#fff',
										 'cursor': null
										 },
								 overlayCSS: {
										 'backgroundColor': '#000', 
										 'opacity': .1 ,
										 'cursor': null
										 }
							 }); 
							 
							 $.post(
		
							"<cfoutput>#buildURL('apiExamAdviceChangeStudent')#</cfoutput>", 
							{
								'stu' : stuId,
								'tsk' : '<cfoutput>#taskId#</cfoutput>',
								'seed': (new Date()).getTime()
							}, 
							function(data) {
								
								 result = $.parseJSON(data);
										
								 if ( result.success ) {
									 
											 
									/* 取消阻挡 */
									$.unblockUI();
						
									 
								 }
								 else {
									 alert('提交失败');
									 /* 取消阻挡 */
									 $.unblockUI();
								 }
							});
							
						}
						
						
						$(document).ready(function() {
						
						
							$("table[data-target] a.marktrigger").click(function(){
								var $trigger = $(this);
								
								var status = $trigger.hasClass("yes");
								var newStatus = true;
							
								/* 切换状态数据 */
								if (status) {
									newStatus = false;
								}
								if ( newStatus ) { 
									$trigger.removeClass("no").addClass("yes");
								} 
								else { 
									$trigger.removeClass("yes").addClass("no"); 
								}
							
							});
							
						});
							
						// -->
						//]]>				
					</script>
				
				
				
                    <cfif rs_student.recordCount eq '0'>
                         <div id="NotFound" class="tabContent">
                              <div class="noticeBlock">
                                        <div class="operation">
                                             <a class="uiButton " href="<cfoutput>#buildURL('studentMarkCreate',passArgs)#</cfoutput>"><i class="mrs img btnAdd"></i><span class="uiButtonText">添加成绩</span></a>
                                        </div>
                                        <h3>目前还没有成绩记录</h3>
                                        <hr/>
                                   </div>
                         </div>
					
				</cfif>
				
			
			</div>
		</li>
	</ul>
</div>